const Linter = require("eslint").Linter;
const linter = new Linter();

const eventListener = require('../rules/event-listener');
const eventNotify = require('../rules/event-notify');
const eventOn = require('../rules/event-on');
const defaulOptions = {
	parserOptions: {
		ecmaVersion: '2018',
		sourceType: 'module',
	},
	rules: {
		'event-listener': 'error',
		'event-notify': 'error',
		'event-on': 'error'
	},
};

linter.defineRules({
	'event-listener': { ...eventListener },
	'event-notify': { ...eventNotify },
	'event-on': { ...eventOn },
});
const verify = (content, config) => {
	const options = {
		rules: { ...config.rules },
	}
	return linter.verify(content, {
		...defaulOptions,
		...options,
	});
};

module.exports = verify;